﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BLToolkit.DataAccess;
using BLToolkit.Mapping;
using DAL;

namespace DE_MVC_WyFy.Areas.Administrator.Models
{
	public class ProductType : BaseEntity<ProductType>
	{
		[PrimaryKey, Identity]
		public int ProductTypeID { get; set; }
		public string ProductTypeName { get; set; }
		public bool IsDeleted { get; set; }
		public String KeyWords { get; set; }
		public bool IsMale { get; set; }
		public int Parent { get; set; }
		public int IDCategory { get; set; }
		[MapIgnore]
		public List<Int32> IdChild
		{
			get
			{
				List<Int32> kq = new List<int>();
				List<ProductType> listChild = ProductType.Objects.Find(c => c.Parent == ProductTypeID).ToList();
				if (listChild != null)
				{
					foreach (var item in listChild)

						kq.Add(item.ProductTypeID);

					return kq;
				}
				else return null;
			}
		}
	}
	//public class ProductTypeDBContext : DbContext
	//{
	//    public DbSet<ProductType> ProductTypes { get; set; }
	//}
}